import React from 'react';
import { Button, Input,Form, InputNumber } from 'antd';
const FormItem = Form.Item;
const formItemLayout = {
    labelCol: {
      xs: {
        span: 24,
      },
      sm: {
        span: 7,
      },
    },
    wrapperCol: {
      xs: {
        span: 24,
      },
      sm: {
        span: 12,
      },
      md: {
        span: 10,
      },
    },
  };
  const submitFormLayout = {
    wrapperCol: {
      xs: {
        span: 24,
        offset: 0,
      },
      sm: {
        span: 10,
        offset: 7,
      },
    },
  };

  const GdWageForm = props => {
    const { item,onFinish,submitting } = props;
    const [form] = Form.useForm();

    const _onFinish = (values,item) =>{
        onFinish(values,item)
    }
    return <Form
    style={{
        marginTop: 8,
    }}
    form={form}
    name="basic"
    onFinish={(values)=>_onFinish(values,item)}
    initialValues={item}
    >
    <FormItem
        {...formItemLayout}
        label="名称"
        name="name"
        rules={[
        {
            required: true,
            message: '请输入名称',
        },
        ]}
    >
        <Input placeholder="请输入"/>
    </FormItem>
    <FormItem
        {...formItemLayout}
        label="月底薪"
        name="salary"
        rules={[
        {
            required: true,
            message: '请输入月底薪',
        },
        ]}
    >
        <InputNumber placeholder="请输入" min={0} style={{width:'100%'}}/>
    </FormItem>
    <FormItem
        {...submitFormLayout}
        style={{
        marginTop: 32,
        }}
    >
        <Button type="primary" htmlType="submit" loading={submitting}>
        保存
        </Button>
    </FormItem>
    </Form>
  }

  export default GdWageForm;